var util = require('../../utils/util.js')
var app = getApp();
Page({
  data: {
    //当前窗口高度,banner的高度
    windowHeight: 500,
    //倒计时跳转
    time: 5
  },

  onLoad: function(options) {
    //设置屏幕高度
    this.setData({
      windowHeight: app.globalData.systemInfo.windowHeight
    })
  },

  onReady: function() {
    var that = this;
    this.data.interval = setInterval(function() {
      var time = that.data.time;
      if (time == 1) {
        clearInterval(that.data.interval);
        that.navIndex();
      }
      --time;
      that.setData({
        time: time
      })
    }, 1000)
  },


  //调到主页
  navIndex: function() {
    //如果定时器存在,则清除
    clearInterval(this.data.interval);
    wx.redirectTo({
      url: '/pages/index/index'
    })
  }
})